'use strict';

angular.module('myApp.hello',['ngRoute']).
    config(['$routeProvider',function($routeProvider){
        $routeProvider.when('/hello',{
            templateUrl:'hello/hello.html',
            controller:'helloCtrl'
        });
    }]).controller('helloCtrl',function($scope){
        $scope.loginEntity={userName:'',
            password:''
        };
        $scope.login=function(){
            //alert('1');
            var $entity=$scope.loginEntity;

            alert($entity.userName+" login success.<br/>"+$entity.currentUser);

        };
        $scope.$watch("loginEntity.userName",function(){
            var $entity=$scope.loginEntity;
            $entity.currentUser="Current user is :"+$entity.userName;
        })
    });